package com.rionosoft.demo.common;

import java.util.List;

import com.rionosoft.demo.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class CommonListAdapter extends BaseAdapter {
	
	private Context mContext;
	private List<CommonMenuItem> mList;
	
	public CommonListAdapter(Context context, List<CommonMenuItem> items) {
		this.mContext = context;
		this.mList = items;
	}

	@Override
	public int getCount() {
		return mList.size();
	}

	@Override
	public Object getItem(int position) {
		return mList.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		convertView = LayoutInflater.from(mContext).inflate(R.layout.common_list_item, null);
		TextView titleView = (TextView) convertView.findViewById(R.id.list_item);
		titleView.setText(mList.get(position).getTitle());
		return convertView;
	}

}
